<template>
  <div>
    <el-button
      type="primary"
      style="margin-bottom: 10px"
      @click="addPage"
      plain
      size="mini"
      ><img src="../../../assets/images/addess.png" style="width:10px;height:10px;margin-right:8px" alt="">添加启动页</el-button
    >
    <div>
      <el-table
        :data="tableData"
        stripe
        style="
          width: 100%;
          overflow-x: auto !important;
          margin-left: 0 !important;
        "
      >
        <el-table-column prop="date" label="序号" width="100">
        </el-table-column>
        <el-table-column prop="name" label="注册名称" width="210">
        </el-table-column>
        <el-table-column prop="address" label="注册页类型" width="210">
        </el-table-column>
        <el-table-column prop="address" label="当前状态" width="210">
        </el-table-column>
        <el-table-column prop="address" label="操作"> 
          <template slot-scope="scope">
            <div>
              <el-button type="text" @click="enable(scope.row)">启用</el-button>
              <el-button type="text" @click="set(scope.row)">修改</el-button>
              <el-button type="text" @click="del(scope.row)">删除</el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <el-dialog
      title="添加注册页面"
      :visible.sync="dialogVisible"
      width="431px"
      :before-close="handleClose"
    >
      <div>
        <div class="addPageList">
          <div class="addPageTitle" style="width: 80px; text-align: right">
            名称：
          </div>
          <div class="addPageCont">
            <el-input
              v-model="input"
              class="inputTxt"
              placeholder="请输入内容"
            ></el-input>
          </div>
        </div>
        <div class="addPageLists">
          <div class="addPageTitle" style="width: 80px; text-align: right">
            上传图标：
          </div>
          <div>
            <div style="font-size: 12px; color: #909399; margin-bottom: 10px">
              （ 尺寸1080px*1920px，图片大小建议不超过1MB）
            </div>
            <el-upload
              :action="httpurl + '/api/fileUpload'"
              list-type="picture-card"
              :on-preview="handlePictureCardPreview"
              :on-remove="handleRemove"
            >
              <i class="el-icon-plus"></i>
            </el-upload>
          </div>

          <el-dialog :visible.sync="dialogVisible1" append-to-body>
            <img width="100%" :src="dialogImageUrl" alt="" />
          </el-dialog>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false"
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      dialogVisible: false,
      dialogVisible1: false,
      dialogImageUrl: "",
      httpurl: this.GLOBAL.httpurl,
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
          zip: 200333,
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1517 弄",
          zip: 200333,
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1519 弄",
          zip: 200333,
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1516 弄",
          zip: 200333,
        },
      ],
    };
  },
  props: ["activeName"],
  methods: {
    addPage() {
      this.dialogVisible = true;
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible1 = true;
    },
  },
};
</script>

<style scoped>
.addPageList {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}
.addPageLists {
  display: flex;
}
/deep/ .inputTxt {
  width: 300px;
}
/* /deep/ .addPageLists{
  display: flex;
} */
/deep/ .inputTxt .el-input__inner {
  width: 100%;
}
</style>